<!--#include file="CheckSession.asp"-->
<!--#include file="../inc/PublicFun.Asp"-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
    <meta name="<%= WebMetal %>" content="<%= WebTitle %>">
    <title><%= WebTitle %></title>
    <link href="css/style.css" rel="stylesheet" type="text/css">
</head>

<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td height="50" align="center" class="title">������</td>
    </tr>
</table>
<%
IF Trim(Request("Action")) = "Submit" Then
		Set Rs = Server . CreateObject("Adodb.RecordSet")
		IF Request . Form("TxtClassID") = "" Then
			Sql = "Select * From mtype"
			Rs . Open Sql,Conn,1,3
			Title = "��ӳɹ�"
			Rs . AddNew
		Else
			Sql = "Select * From mtype Where ID=" & Request("TxtClassID") & ""
			Rs . Open Sql,Conn,1,3
			Title = "�޸ĳɹ�"
		End IF
Rs("ClassName") = Trim(Request . Form("classname"))
Rs . Update
		Rs . Close()
		Set Rs = Nothing
		Response . Write("<script language='javascript'>alert(""" & Title & """);window.location.href='Admin_TypeList.asp'</script>")
	End IF

IF Request("Action") = "del" Then
	'ɾ��
		conn.execute("delete from class where id="&trim(request("id"))&"")
		response.Write("<script language='javascript'>window.location.href='Admin_TypeList . asp'</script>")
	End IF

%>
 
<div style="text-align:center; margin-top:10px">
<fieldset style="width:50%;">
<legend>�������</legend>
<br>
<form name="form1" action="?action=Submit" method="post">
<table width="68%" border="0" align="center" cellpadding="5" cellspacing="0" bordercolorlight="#FFFFFF" bordercolordark="#CCCCCC">
  <tr>
    <td width="15%" height="55" align="right" nowrap>����</td>
    <td width="56%"><input name="classname" value="<%=WebName%>" type="text" class="inputtext" style="width:100%"><input name="TxtClassID" type="hidden"></td>
    <td width="10%">&nbsp;</td>
  </tr>
  <tr>
    <td height="35" colspan="3" align="center" valign="bottom" nowrap>
      <input name="Submit" type="Submit" class="button" value="ȷ��">
      &nbsp;&nbsp;&nbsp;&nbsp;
      <input name="Submit2" type="reset" class="button"  value="����"></td>
  </tr>
</table>
</form>
</fieldset>
</div>
<script language="javascript">
function ModDate(ClassId,ClassName){
	document.form1.classname.value=ClassName;
	document.form1.TxtClassID.value=ClassId;
	document.form1.Submit.value="ȷ���޸�";
	document.form1.Submit2.disabled=true;	
}
</script>
<br>
<table width="50%" height="25" border="1" align="center" cellpadding="4" cellspacing="0" bordercolorlight="#ffffff" bordercolordark="#CCCCCC"> 
  <tr>
    <td width="22%" height="25" align="center" class="borderon">����</td>
    <td align="center" class="borderon">�����</td>
  </tr>
<%
	Set Rs=Server.CreateObject("Adodb.RecordSet")
	Sql="Select * from mtype "
	Rs.open Sql,Conn,1,3
	If not(Rs.Eof and Rs.Bof) then
		Do while not Rs.Eof 
%> 
  <tr>
    <td align="center"><a href="#" onClick="if (confirm('ȷ��ɾ��')==true){window.location.href=' ? action = del & id =<%=rs("id")%>
'}">ɾ��</a>|<a href="javascript:void(null)" onClick="ModDate('<%= rs("id") %>','<%= rs("classname") %>')">�޸�</a></td>
<td><%= rs("classname") %>&nbsp;</td>
</tr>
<%
Rs . MoveNext
		Loop
	End IF
    Rs . Close()
Set Rs = Nothing
%>
</table>
</body>
</html>